﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
namespace QuanLyKhachSan
{
    public partial class UC_TienNghi_SapXep : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    TienNghi_Load();
                }
                catch (Exception ex)
                {
                    
                    throw ex;
                }
            }
        }
        protected void TienNghi_Load()
        {
            try
            {
                List<TienNghiInfo> list = TienNghiBLL.TienNghi_GetItems();
                rlbTienNghi.DataSource = list;
                rlbTienNghi.DataTextField = "TienNghiName";
                rlbTienNghi.DataValueField = "TienNghiID";
                rlbTienNghi.DataBind();
            }
            catch (Exception)
            {                
                throw;
            }
        }
        protected void cmdCapNhap_Click(object sender, EventArgs e)
        {
            try
            {
                string listSorted = "";
                foreach (RadListBoxItem item in rlbTienNghi.Items)
                {
                    listSorted += item.Value + ";";
                }
                TienNghiBLL.TienNghi_SapXep(listSorted);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
}
}